package base_NIO.BIO;

import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;

public class BIOServer {
    public static void main(String[] args) throws Exception {
        ServerSocket ss = new ServerSocket();
        ss.bind(new InetSocketAddress(7777));
        while(true){
            Socket sk = ss.accept();
            new Thread(new ServiceRunner(sk)).start();
        }
    }
}
class ServiceRunner implements Runnable{
    private Socket sk;
    public ServiceRunner(Socket sk){
        this.sk = sk;
    }
    public void run(){
        System.out.println("提供服务的线程id："+
                Thread.currentThread().getId());
        try {
            Thread.sleep(Integer.MAX_VALUE);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}